package com.HomeWork12.work2;

import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {

        System.out.println("1,龙。2，小兵。3.石像鬼");
        System.out.println("请玩家输入要攻击的对象：" );


        int n=new Scanner(System.in).nextInt();
        switch (n){
            case 1:
                Dragon();
                break;
            case 2:
                dogface();
                break;
            case 3:
                gargoyles();
                break;




        }


    }
    public static void gargoyles(){
        Gargoyles gargoyles = new Gargoyles("石像鬼",5000,400,80,50);
        Player player = new Player("张飒",2000,300,3000);
        while (true) {
            player.attack(gargoyles);
            if (gargoyles.getBlood()<=0){System.out.println(gargoyles.getName()+"被打死了，游戏结束");
                System.out.println(player.getProfession()+"剩余的血量为:"+player.getPlayerBlood());
                break;
            }
            gargoyles.attack(player);
            if (player.getPlayerBlood()<=0){
                System.out.println(player.getProfession()+"被打死了，游戏结束");
                System.out.println(gargoyles.getName()+"剩余的血量为:"+gargoyles.getBlood());
                break;
            }
        }
    }
    public static void dogface(){
        Dogface dogface = new Dogface("小兵",2000,200,20,50);
        Player player = new Player("张飒",2000,300,3000);
        while (true) {
            player.attack(dogface);
            if (dogface.getBlood()<=0){System.out.println(dogface.getName()+"被打死了，游戏结束");
                System.out.println(player.getProfession()+"剩余的血量为:"+player.getPlayerBlood());
                break;
            }
            dogface.attack(player);
            if (player.getPlayerBlood()<=0){
                System.out.println(player.getProfession()+"被打死了，游戏结束");
                System.out.println(dogface.getName()+"剩余的血量为:"+dogface.getBlood());
                break;
            }
        }
    }
    public static void Dragon(){
        Player player = new Player("张飒",2000,300,3000);
        Dragon d=new Dragon("龙",2000,2000,1000,50);
        while (true) {
            player.attack(d);
            if (d.getBlood()<=0){System.out.println(d.getName()+"被打死了，游戏结束");
                System.out.println(player.getProfession()+"剩余的血量为:"+player.getPlayerBlood());
                break;
            }
            d.attack(player);
            if (player.getPlayerBlood()<=0){
                System.out.println(player.getProfession()+"被打死了，游戏结束");
                System.out.println(d.getName()+"剩余的血量为:"+d.getBlood());
                break;
            }
        }
    }
}
